Page({
  data: {
    headerSrc: '',
    userInfo: '',
    date: '2016-09-01',
    tabIndex: 0,
    height: '',
    res: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  },
  onLoad: function() {
    wx.getSystemInfo({
      success: (res) => {
        this.setData({
          height: res.windowHeight
        })
      }
    })
  },
  bindDateChange: function(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date: e.detail.value
    })
  },
  changeTab(e) {
    let id = e.currentTarget.dataset.id
    this.setData({
      tabIndex: id
    })
  },
  lower() {
    var result = this.data.res;
    var resArr = [];
    for (let i = 0; i < 10; i++) {
      resArr.push(i);
    };
    var cont = result.concat(resArr);
    console.log(resArr.length);
    if (cont.length >= 100) {
      wx.showToast({ //如果全部加载完成了也弹一个框
        title: '我也是有底线的',
        icon: 'success',
        duration: 300
      });
      return false;
    } else {
      wx.showLoading({ //期间为了显示效果可以添加一个过度的弹出框提示“加载中”  
        title: '加载中',
        icon: 'loading',
      });
      setTimeout(() => {
        this.setData({
          res: cont
        });
        wx.hideLoading();
      }, 1500)
    }
  },
  topLoad: function(event) {
    //   该方法绑定了页面滑动到顶部的事件，然后做上拉刷新
    this.setData({
      res: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    });
    console.log("lower");
  }
})